# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=dqlite
pkgver=1.16.7
pkgrel=0
pkgdesc="Embeddable, replicated and fault tolerant SQL engine"
url="https://dqlite.io/"
arch="all"
license="LGPL-3.0-only"
depends="raft"
makedepends="libuv-dev sqlite-dev raft-dev autoconf automake libtool linux-headers"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/canonical/dqlite/archive/v$pkgver.tar.gz
	no-werror.patch
	execinfo.patch
	disable-failing-tests.patch
	"

prepare() {
	default_prepare
	autoreconf -i
}

build() {
	./configure  \
		--prefix=/usr
	make
}

check() {
	# for these arch, make check fails
	case "$CARCH" in
		aarch64|s390x|ppc64le|riscv64) return 0 ;;
		*) make check
	esac
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/dqlite/LICENSE
}

sha512sums="
ee63ac49355e3be1e70608e6f20863d365ab7983e704134b6c881312cba16f7cb137835492f6869f216795d166c0e54880aca6ff29000633350fe3835564029a  dqlite-1.16.7.tar.gz
3979f6476d819d67007381d1b3c29c1444973f9dc17e2d637eeb455404c1a1039f4191cf8a844639fb61aee2e3d0661b9c8b70383790920d79c14cf3482eec67  no-werror.patch
7d0ea194311f11c5f62f92125f1bb6a7bd532bf443ca36624a889e36de0a1eace7f87c39922f754cf16094e02182d0986b384705734fb6bdf347c13bf1c28ab3  execinfo.patch
fc5093783a48143b636c56d28f5fd38d2a319039c9d9dcde45643ee056e4f3f117031811fe41a1e476d326af446eb61ff3970456ce16b551fb3707cf7dfbdef3  disable-failing-tests.patch
"
